package com.cckj.common.customAssert;

import com.cckj.common.exception.BusinessException;
import org.springframework.lang.Nullable;

public class AssertCustom {

    public static void notNull(@Nullable Object object, String message) {
        if (object == null) {
            throw new BusinessException(message);
        } else {
            if (object instanceof String) {
                if (object.toString().trim().length() < 1) {
                    throw new BusinessException(message);
                }
            }
        }
    }

    public static void isNull(@Nullable Object object, String message) {
        if (object != null) {
            throw new BusinessException(message);
        }
    }

    public static void isTrue(Boolean object, String message) {
        if (!object) {
            throw new BusinessException(message);
        }
    }
}
